package jpb.Interceptor.configuration;

import jpb.Interceptor.AppLoginInterceptor;
import jpb.module.service.member.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by haol on 2017/4/20.
 */
@Configuration
public class   AppLoginInterceptorConfigation extends WebMvcConfigurerAdapter {
        @Autowired
        private MemberService memberService;

        public void addInterceptors(InterceptorRegistry registry) {
                InterceptorRegistration interceptorRegistry = registry.addInterceptor(
                        new AppLoginInterceptor(memberService));
                interceptorRegistry.addPathPatterns("/api/app/**");
                interceptorRegistry.excludePathPatterns("/api/app/log/login");
                interceptorRegistry.excludePathPatterns("/api/app/log/logout");
                interceptorRegistry.excludePathPatterns("/api/app/follow/com-all-org");

                interceptorRegistry.excludePathPatterns("/api/app/member/register");
        }
}
